//-----------------------------------------------------------------------------
/// STATE_INIT (Implementation)
//-----------------------------------------------------------------------------
START_STATE_CODE( STATE_MAINMENU )
{
    START_MESSAGE_HANDLER( MESSAGE_ENTER )
    {
		StateMainMenuInit();
    }

    START_MESSAGE_HANDLER( MESSAGE_UPDATE )
    {		
		StateMainMenuUpdate();
    }

    START_MESSAGE_HANDLER( MESSAGE_PAINT )
    {
		StateMainMenuPaint(s_gBackBuffer);
    }

    START_MESSAGE_HANDLER( MESSAGE_EXIT )
    {
		// GameDestroy();
		// StateLogoExit();
		_menu_last_item_selected = _menu_item_selected;
    }

	START_MESSAGE_HANDLER( MESSAGE_HIDENOTIFY )
	{
		// GameHideNotify();
	}
}

static Image imgMainMenuBG = null;
static ASprite s_sprMenu = null;

static void StateMainMenuInit()
{	
	try
	{
		imgMainMenuBG = Image.createImage("/bg_mainmenu.png");
		s_sprMenu = new ASprite();
		s_sprMenu.LoadSprite("/game_menu.bin");
		// PaintModule(s_g, i,m_iImgLocationX,m_iImgLocationY);
	}
	catch(Exception ex)
	{
		System.out.println("!!!! STATE_MAINMENU error");
	}
	
	_menu_x = (s_iWidth - MENU_WIDTH)/2;
	_menu_y = s_iHeight - (MENU_HEIGHT + _menu_spacing)*(menu_main.length-1);
	SetSoftkey(false, false);
	// _menu_item_focused = _menu_last_item_selected;
	_menu_item_focused = 0;
	_menu_item_selected = -1;
}

static void StateMainMenuUpdate()
{
	Update_MainMenu();
	// UpdateSoftkey();
}

static void StateMainMenuPaint(Graphics g)
{
	Paint_MainMenu(g);
}

